//
//  FFPayOrderShippingWayCell.m
//  FFMall
//
//  Created by ale tan on 2017/9/22.
//  Copyright © 2017年 IT.Bear. All rights reserved.
//

#import "FFPayOrderShippingWayCell.h"
#import "NSString+TitleSize.h"

@interface FFPayOrderShippingWayCell ()

@property (weak, nonatomic) IBOutlet UIButton *statusButton;
@property (weak, nonatomic) IBOutlet UILabel *shippingWayLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *describeLabel;

@end

@implementation FFPayOrderShippingWayCell

+ (CGFloat)calculateForHeightWithString:(NSString *)string{
    NSString *description = string?string:@"";
    description = [description stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"];
    return [description sizeWithStringFont:APP_FONT_PINGFANG_SC(12) constrainedToSize:CGSizeMake(IPHONE_WIDTH-107, 0) HadSpace:YES].height+63;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (void)updateCellWithModel:(FBShippingWayModel *)model IndexPath:(NSIndexPath *)indexPath{
    _shippingWayLabel.text = model.shippingTitle;
    _describeLabel.text = [model.shippingDescription stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"];
    _priceLabel.text = [NSString stringWithFormat:@"运费总计：¥%@",model.freight];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    _statusButton.selected = selected;
}

@end
